﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "IElement.h"
#include "GcmpModelInterface.h"
#include "GbmpQuickCast.h"

namespace gcmp
{
    class IFamilyType;
    class IFamily;

    /// \brief  族配置元素接口类
    ///
    /// 族配置类型描述了对应族的一些元数据，比如族的文件名、路径和族服务提供商.
    /// \see IFamily
    class GCMP_MODEL_INTERFACE_EXPORT IFamilyConfigElement : public IElement
    {
        DEFINE_CAST_DERIVED(gcmp::IFamilyConfigElement, gcmp::IElement)
    public:
        /// \brief 通过族名字返回对应的族配置对象
        /// 
        /// \param pDocument 文档指针
        /// \param familyName 族名字
        /// \return 如果存在，返回族配置对象，否则返回空指针
        static IFamilyConfigElement* GetFamilyConfigElementByName(const IDocument* pDocument, const std::wstring& familyName);

        /// \brief 通过组Id返回对应的族配置对象
        /// 
        /// \param pDocument 文档指针
        /// \param familyIdInCloud 族的Id，此处的Id为通过GetFamilyIdInCloud获取的Id
        /// \return 如果存在，返回族配置对象，否则返回空指针
        static IFamilyConfigElement* GetFamilyConfigElementById(const IDocument* pDocument, Int64 familyIdInCloud);

        /// \brief 返回族文档名
        ///
        /// \return 族文档名
        virtual std::wstring GetFamilyFileName() const = 0;

        /// \brief 返回族文档路径
        /// 
        /// \param pDocument 文档指针
        /// \return 族文档路径
        virtual std::wstring GetFamilyFilePath(const IDocument* pDocument) const = 0;

        /// \brief 返回族服务提供商的UniIdentity
        ///
        /// \return 族服务提供商的UniIdentity
        virtual const UniIdentity& GetFamilyServiceProviderUid() const = 0;

        /// \brief 返回族在项目内标识唯一的UniIdentity
        ///
        /// \return 族在项目内标识唯一的UniIdentity
        virtual const UniIdentity& GetFamilyUid() const = 0;

        /// \brief 返回族在项目内的ID
        ///
        /// \return 族在项目内的ID
        virtual Int64 GetFamilyIdInCloud() const = 0;

        /// \brief 设置族在项目内的ID
        ///
        /// \param familyIdInCloud 族在项目内的ID
        /// \return void
        virtual void SetFamilyIdInCloud(Int64 familyIdInCloud) = 0;

        /// \brief 返回族在项目内的版本号
        ///
        /// \return 族在项目内的版本号
        virtual int GetFamilyVersionInCloud() const = 0;

        /// \brief 设置族在项目内的版本号
        ///
        /// \param familyVersionInCloud 族在项目内的版本号
        /// \return void
        virtual void SetFamilyVersionInCloud(int familyVersionInCloud) = 0;

        /// \brief 返回是否需要将族上传到云端
        ///
        /// \return 族是否需要上传到云端标记
        virtual bool IsNeedUploadToCloud() const = 0;

        /// \brief 设置是否需要上传到云端标记
        ///
        /// \param isNeedUploadToCloud 是否需要上传到云端标记
        /// \return void
        virtual void SetIsNeedUploadToCloud(bool isNeedUploadToCloud) = 0;

        /// \brief 返回对应的族对象
        ///
        /// \return 族对象
        virtual const IFamily* GetFamily() const = 0;

    public:
        /// \brief 获取Implementation Uid
        ///
        /// \return UniIdentity 返回ImplementationUid
        static UniIdentity GetImplementationUid();
        
    };    
}


